package conf

import log "github.com/sirupsen/logrus"

const (
	TEST = "test"
	PROD = "prod"
)
const tia_suffix = "_tias"
const (
	DB_GROUP        = "tia_comics_group"
	DB_GROUP_MEBMER = "tia_comics_groupmember"
	DB_POST         = "tia_comics_post"
	DB_USER         = "tia_comics_user"
	DB_COMMENT      = "tia_comics_comment"
	DB_COMMENT_OP   = "tia_comics_user_comment_op"
	DB_USER_POST_OP = "tia_comics_user_post_op"
)

var Env string

const (
	ID_FROMAT_GROUP   = "%d#g_tias"
	ID_FROMAT_USER    = "%d#u-%d#m_tias"
	ID_FORMAT_COMMENT = "%d#c-%d#p" + tia_suffix
	ID_FORMAT_POST    = "%d#p-%d#g" + tia_suffix
)

var (
	Tia_user_db_num                    = 2
	Tia_global_original_tab_offset_num = 1000000
	Tia_global_activity_tab_offset_num = 1000000
	Tia_skill_global_tab_offset_num    = 1000000
	Tia_message_col_num                = 2
	Tia_notification_col_num           = 2

	Tia_comment_col_num         = 2
	Tia_user_comment_op_col_num = 2

	Tia_user_col_num    = 2
	Tia_user_op_col_num = 2

	Tia_group_col_num         = 2
	Tia_group_member_col_num  = 2
	Tia_user_group_op_col_num = 2

	Tia_original_group_col_num = 2
	Tia_activity_group_col_num = 2

	Tia_post_col_num         = 2
	Tia_resource_loc_col_num = 2
	Tia_user_post_op_col_num = 2

	Tia_square_col_num = 2
)

func InitConfig() {
	log.Infof("当前运行的环境为：%v", Env)
	if Env == PROD {
		Tia_user_db_num = 2
		Tia_user_col_num = 256
		Tia_user_op_col_num = 256

		Tia_group_col_num = 64
		Tia_group_member_col_num = 64
		Tia_user_group_op_col_num = 64

		Tia_original_group_col_num = 64
		Tia_global_original_tab_offset_num = 1000000

		Tia_activity_group_col_num = 64
		Tia_global_activity_tab_offset_num = 1000000

		Tia_post_col_num = 256
		Tia_resource_loc_col_num = 256
		Tia_user_post_op_col_num = 256
		Tia_skill_global_tab_offset_num = 1000000

		Tia_comment_col_num = 256
		Tia_user_comment_op_col_num = 256

		Tia_message_col_num = 256
		Tia_notification_col_num = 256

		Tia_square_col_num = 256
	}
}
